package com.pearlsoft.rms;

import java.util.List;
import java.util.Map;
import java.util.logging.Level;

import com.pearlsoft.webapp.core.service.BaseService;
import com.vmware.vcloud.sdk.OrgNetwork;
import com.vmware.vcloud.sdk.Organization;
import com.vmware.vcloud.sdk.VCloudException;
import com.vmware.vcloud.sdk.VM;
import com.vmware.vcloud.sdk.Vapp;
import com.vmware.vcloud.sdk.Vdc;
import com.vmware.vcloud.sdk.admin.AdminOrganization;
import com.vmware.vcloud.sdk.admin.AdminVdc;

/**
 * 
 * @author rainshow
 * @Created 2012-5-9 上午09:17:27
 */

public interface VcloudManager extends BaseService {

    //boolean login(String url, String user, String password);

    void setLogLevel(Level level);

    Map<String, Organization> getOrgMap();

    Map<String, Vdc> getVdcMap(Organization org);

    Map<String, Vapp> getVappMap(Vdc vdc);

    List<VM> getVMList(Vapp app);

    Map<String, OrgNetwork> getNetworkMap(Organization org);

    Organization findOrgByName(String name);

    Vdc findVdc(String orgName, String vdcName) throws Exception;

    Map<String, AdminOrganization> getAdminOrgMap();

    Map<String, AdminVdc> getAdminVdcMap(AdminOrganization org);

    List<VM> createVapp(VappConfig config);

    boolean startVM(VM vm) throws VCloudException;

    VM findVm(String orgName, String vdcName, String vappName, String vmName) throws Exception;

    Map<String, String> getVdcAvailableResource(String orgName, String vdcName) throws Exception;

    Map<String, String> getVdcAvailableResource(Vdc vdc) throws Exception;

    String acquireTicket(String orgName, String vdcName, String appName, String vm) throws Exception;

    Map<String, String> getVdcResource(String orgName, String vdcName) throws Exception;

    Map<String, String> getVdcResource(Vdc vdc) throws Exception;

    String getVmPassword(String orgName, String vdcName, String vappName, String vmName) throws Exception;

    void updateVm(String orgName, String vdcName, String vappName, String vmName, int cpuNum, int memSize,
            int networkIncrement, int diskIncrement) throws Exception;

    void cloneVapp(String orgName, String vdcName, String vappName, String targetOrg, String targetVdc, String baseline)
            throws Exception;

    Vapp findVapp(Vdc vdc, String vappName) throws Exception;

    Vapp findVapp(String orgName, String vdcName, String vappName) throws Exception;

    void startVapp(Vapp vapp) throws Exception;

    void closeVapp(Vapp vapp) throws Exception;
}
